<template>
  <router-view />
</template>

<script lang="ts" setup>
import {onMounted} from 'vue';
import { useStore} from '@/store';
import { useRouter } from 'vue-router';
const store = useStore();
const router = useRouter();

onMounted(() => {
  const userName = sessionStorage.getItem('username');
  if(userName) {
    store.setUserName(userName);
  }else {
    router.push('/login');
  }
})
</script>

<style lang="less">
@import url("//at.alicdn.com/t/c/font_4782513_7ewxodz8jim.css");

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
#app {
  width: 100%;
  height: 100%;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

</style>
